/**
* ...
* @author Default
* @version 0.1
*/

package com.crlclr.ui {
	import caurina.transitions.Tweener;
	
	import com.crl.ui.controls.Component;
	import com.crlclr.managers.*;
	
	import flash.events.MouseEvent;

	public class QPButton extends Component {
		private var skinID:String;
		private var skin:*;
		public function QPButton(skinID:String = "QpButtonSkin") {
			this.skinID = skinID;
			this.mouseChildren = false;
			this.buttonMode = true;
			this.alpha = .4;
			super();
			
		}
		protected override function create():void{
			var QpButtonSkin:Class = SkinManager.getInstance().getClass(skinID);
			skin = new QpButtonSkin();
			addChild(skin);
		}
		
		
		
		public function get Skin():*{
			return skin;
		}
		protected override function bind():void{
			super.bind();
			this.addEventListener(MouseEvent.MOUSE_OVER, overHander);
			this.addEventListener(MouseEvent.MOUSE_OUT, outHander);
		}
		
		private function overHander(event:MouseEvent):void {
			Tweener.addTween(this, {alpha:1.0,time:1,transition:"easeinsine"});
		}
		private function outHander(event:MouseEvent):void {
			Tweener.addTween(this, {alpha:.4,time:.4,transition:"easeinsine"});
		}
	}
	
}
